package com.automannn.springboot.practice.autoconfigure;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Component;

import java.util.Arrays;

/**
 * @author chenkh
 * @time 2021/10/9 14:49
 */
public class AutoConfigurationTest {
    public static void main(String[] args) {

        /*xxx: springboot最核心的注解，实际上只需要  @EnableAutoConfiguration 即可 */
        /*xxx: springBoot除了需要依赖注解外，还需要依赖 springApplication 提供的 执行模板 */
        /*xxx: 更进一步的，springBoot的核心是： AutoConfigurationImportSelector 这个类。 */
        SpringApplication application = new SpringApplication(BootstrapBean.class);
       ConfigurableApplicationContext applicationContext= application.run(args);
        System.out.println(applicationContext.getBeanDefinitionCount());
        System.out.println(Arrays.asList(applicationContext.getBeanDefinitionNames()));


    }

    @EnableAutoConfiguration
    public static class BootstrapBean{

    }
}
